<admintpl file="header" />
<link rel="stylesheet" href="__PUBLIC__/css/simple_upload.css" type="text/css" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:U('Admin/LiveProp/index')}">道具列表</a></li>
			<li class="active"><a href="{:U('Admin/LiveProp/add')}">添加道具</a></li>
		</ul>
		<form method="post" class="form-horizontal js-ajax-form" action="{:U('Admin/LiveProp/add_post')}">
				<div class="control-group">
					<label class="span1 control-label" style="width: 90px;">道具名称：</label>
					<div class="span3">
						<input type="text" name="name">
					</div>
					<label class="span1 control-label" style="width: 90px;">状态：</label>
					<div class="span3" style="padding-top:3px;">
						<label class="span1 radio" style="width: 36px;">
						  <input type="radio" checked name="status" value="1" >
						  启用
						</label>
						<label class="span1 radio" style="width: 36px;">
						  <input type="radio" name="status" value="0" >
						  停用
						</label>
					</div>
					
				</div>
				
				<div class="control-group">
					<label class="span1 control-label" style="width: 90px;">道具描述：</label>
					<div class="span7">
						<textarea style="width: 556px; height: 60px;" name="remark"></textarea>
					</div>
				</div>
				<div class="control-group">
				    <label class="span1 control-label" style="width: 90px;">汇闻币数量：</label>
					<div class="span3">
						<input type="text" name="amount">
					</div>
					<label class="span1 control-label" style="width: 90px;">图标图片：</label>
					<div class="span4 wrapper">
                          <div id="uploader-image">
                              <div id="fileList" class="uploader-list">
                                  <div id="imageDiv" class="file-item thumbnail" style="width:150px;height: 150px;">
                                      <img id="imagePreview" src="__PUBLIC__/images/furley_bg.png" style="width:150px;height: 140px;">
                                      <div id="picker" class="info">选择图片&nbsp;&nbsp;&nbsp;&nbsp;</div>
                                      <input style="display:none;" type="file" id="imageFile" name="imageFile" >
                                  </div>
                              </div>
                          </div>
                    </div>
				</div>
				
			<div class="form-actions" style="padding-left:260px;">
				<button type="submit" class="btn btn-primary js-ajax-submit">保存</button>
				&nbsp;&nbsp;<a class="btn" href="{:U('Admin/LiveProp/index')}">{:L('BACK')}</a>
			</div>
		</form>
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/content_addtop.js"></script>
	<script type="text/javascript" >
		function html5Reader(file, previewId){
	        var file = file.files[0];
	        var reader = new FileReader();
	        reader.readAsDataURL(file);
	        reader.onload = function(e){
	            $('#'+previewId).attr('src', this.result);
	        }
	    }
	    function image_change(fileId, previewId) {
	        var pic = document.getElementById(previewId),
	                file = document.getElementById(fileId);
	
	        var ext = file.value.substring(file.value.lastIndexOf(".")+1).toLowerCase();
	
	        // gif在IE浏览器暂时无法显示
	        if(ext != 'png' && ext != 'jpg' && ext != 'jpeg'){
	            alert("图片的格式必须为png或者jpg或者jpeg格式！");
	            return;
	        }
	        var isIE = navigator.userAgent.match(/MSIE/)!= null,
	                isIE6 = navigator.userAgent.match(/MSIE 6.0/)!= null;
	
	        if(isIE) {
	            file.select();
	            var realLocalPath = document.selection.createRange().text;
	
	            // IE6浏览器设置img的src为本地路径可以直接显示图片
	            if (isIE6) {
	                pic.src = realLocalPath;
	            }else {
	                // 非IE6版本的IE由于安全问题直接设置img的src无法显示本地图片，但是可以通过滤镜来实现
	                pic.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod='image',src=\"" + realLocalPath + "\")";
	                // 设置img的src为base64编码的透明图片 取消显示浏览器默认图片
	                pic.src = '';
	            }
	        }else {
	            html5Reader(file, previewId);
	        }
	    }
		
		$("#picker").click(function(){
            $("#imageFile").click();
        });
		
		$("#imageFile").change(function(){
			image_change('imageFile', 'imagePreview');
        });
	</script>
</body>
</html>